<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>询价</title>
    <link rel="stylesheet" type="text/css" href="/static/index_user/css/aui_1.css" />
    <link rel="stylesheet" type="text/css" href="/static/index_user/css/aui-slide_1.css" />
    <link rel="stylesheet" type="text/css" href="/static/index_user/css/jquery.autocomplete.css" />
    <!--<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>-->
    <script src="/static/index_user/js/jquery-1.6.1.js" type="text/javascript"></script>

    <script src="/static/index_user/js/jquery.autocomplete.js" type="text/javascript"></script>
    <script>
        window.alert = function(name){
            var iframe = document.createElement("IFRAME");
            iframe.style.display="none";
            document.documentElement.appendChild(iframe);
            window.frames[0].window.alert(name);
            iframe.parentNode.removeChild(iframe);
        }
        window.confirm = function (message) {
            var iframe = document.createElement("IFRAME");
            iframe.style.display = "none";
            iframe.setAttribute("src", 'data:text/plain,');
            document.documentElement.appendChild(iframe);
            var alertFrame = window.frames[0];
            var result = alertFrame.window.confirm(message);
            iframe.parentNode.removeChild(iframe);
            return result;
        }
    </script>
    <script type="text/javascript">
//        $(function() {
//
//            $("#stockcode").AutoComplete({
//                'data': ['Cambodia', 'Cameroon', 'Canada', 'Cape-Verde', 'Cayman-Islands', 'Central-African-Republic', 'Chad', 'Chile', 'China', 'Colombia', 'Commonwealth', 'Comoros', 'Costa-Rica', "Cote-d'Ivoire", 'Croatia', 'Cuba', 'Cyprus', 'Czech-Republic'],
//            });
//
//        })
    </script>
    <script type="text/javascript">
        function submitt() {

            var stockcode = document.loginForm.stockcode.value;
//
            if(stockcode == null || stockcode == '' || stockcode.length == 0) {
                alert("请输入股票代码");
                document.loginForm.stockcode.select();
                return false;
            }
//
//            document.loginForm.submit();
//            console.log(stockcode);
            showAjax(stockcode);

        }
        function showAjax(stockcode) {
            $.ajax({
                type: 'get',
                url: '/user/Xunjia/get/' + stockcode,
                dataType: 'json',
                success: function (data) {
//                    console.log(data);
                    if (data) {
//                        $('.modal-title u').html(data.title);
//                        var msg = data.datas.id + ' | ' + data.datas.name + ' | ' + data.datas.age + ' | ' + data.datas.sex + ' | ' + data.datas.tel;
//                        $('.modal-body h3').html(msg);
                        console.log(data);
                        console.log(data.stockcode);
                        $('#tempcode').html(data.stockcode);
                        $('#tempname').html(data.name);
                        $('#tempprice').html(data.price);
                        $('#xdstockcode').val(data.stockcode);
                        $('#xdstockname').val(data.name);

                    } else {
//                        $('.modal-title u').html(data.title);
//                        $('.modal-body h3').html(data.datas);
//                        console.log(222);
                        alert('查询不到该股票');
                    }
                },
                error: function () {
                    alert('AJAX操作失败');
                }
            });
        }
    </script>
    <style type="text/css">
        .aui-list .aui-list-header {
            background-color: #2c3039;
            color: #ffffff;
            text-align: center;
            justify-content: center;
            border-bottom: 1px solid #1e2128;
            font-size: 1rem;
        }

        .aui-grid [class*=aui-col-] {
            padding: 0.2rem 0;
            text-align: left;
        }

        .aui-list label {
            line-height: 1.8rem;
            width: 200px;
        }
    </style>
</head>

<body>
<header class="aui-bar aui-bar-nav" style="position: fixed;">
    <a class="aui-pull-left aui-btn">

    </a>
    <div class="aui-title">询价</div>
</header>
<div id="msg" class="" style=" display: none; width: 100%;position: fixed;top: 6%;z-index: 99;color: red;background-color: yellow;text-align: center">您有新消息,请在消息中心查看</div>
<div class="aui-tab" id="tab" style="margin-top: 48px;">
    <div class="aui-tab-item aui-active">搜索询价</div>
    <div class="aui-tab-item">
        <a href="{:url('user/Xunjia/myxunjia')}" style="color:#ffffff">我的询价</a>
    </div>
</div>
<form id="loginForm" name="loginForm" method='get' action="{:url('user/Xunjia/index')}" id="cxgpss">
    <div class="aui-content aui-margin-t-15 aui-margin-b-15" id="search" style="height:60px;">
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item" style="width:60%">
                        <input type="text" name="stockcode" id="stockcode" value="{$data.stockcode}" placeholder="请输入股票代码" class="text">
                        <!--<input id="test" type="text" value="" class="text"/>-->

                    </div>
                    <div class="aui-list-item" style="margin-top:10px;margin-right:20px;">
                        <a href="javascript:void(0)" class="btn-login" id="btn-login" onclick="submitt()">
                            <div class="aui-btn aui-btn-info" style="width:100px;height:40px;line-height:40px;">搜索</div>
                        </a>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</form>

<div class="aui-content aui-margin-t-15">
    <ul class="aui-list aui-select-list">
        <li class="aui-list-header">询价信息</li>

    </ul>
</div>
<form id="dom" name="dom" method='post' action='{:url('user/Xunjia/addask')}'>
    <div class="aui-content aui-margin-b-15" style="margin-bottom:2.5rem !important">
        <ul class="aui-list aui-form-list">

            <li class="aui-list-item">
                <div class="aui-list-item-inner" style="justify-content: right;">
                    <div class="aui-list-item-label">
                        股票代码：
                    </div>
                    <div class="aui-list-item-input" id="tempcode" style="color:red">
                        {$data.stockcode}							</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        股票名称：
                    </div>
                    <div class="aui-list-item-input" id="tempname" style="color:red">
                        {$data.name}							</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        当前价格：
                    </div>
                    <div class="aui-list-item-input" id="tempprice" style="color:red">
                        {$data.price}							</div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        交易周期：
                    </div>
                    <div class="aui-list-item-input" style="margin-top:0.5rem;margin-bottom:0.5rem;">
                        <div class="aui-row">
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="jyzq" checked="" value="1周"> 1周</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="jyzq" value="2周"> 2周</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="jyzq" value="1个月"> 1个月</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="jyzq" value="2个月"> 2个月</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="jyzq" value="3个月"> 3个月</label>
                            </div>
                            <div class="aui-col-xs-4">

                            </div>
                        </div>

                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        名义本金：
                    </div>
                    <div class="aui-list-item-input" style="margin-top:0.5rem;margin-bottom:0.5rem;">
                        <div class="aui-row">
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="mybj" checked="" value="100000"> 10万</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="mybj" value="200000"> 20万</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="mybj" value="500000"> 50万</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="mybj" value="1000000"> 100万</label>
                            </div>
                            <div class="aui-col-xs-4">
                                <label class="radio"><input class="aui-radio" type="radio" name="mybj" value="5000000"> 500万</label>
                            </div>
                            <div class="aui-col-xs-4">

                            </div>
                        </div>
                    </div>
                </div>
            </li>

            <li class="aui-list-item">
                <div class="aui-row" style="width: 100%;">
                    <input type='hidden' name="xdstockcode" id="xdstockcode" value="{$data.stockcode}">
                    <input type='hidden' name="xdstockname" id="xdstockname" value="{$data.name}">
                    <div class="aui-col-xs-7" style="margin-top:10px;margin-bottom:10px;text-align:right">
                        <!--<a href="javascript:void(0);" class="kc">-->
                            <button class="aui-btn" style="border:none; width:100px;height:40px;color:#ffffff;line-height:40px;margin-right:5px;background-color: red !important;"  >询价</button>
                        <!--</a>-->
                    </div>
                    <!--<div class="aui-col-xs-6" style="margin-top:10px;margin-bottom:10px;text-align:left">-->
                        <!--<a href="javascript:alert('询价时间为交易日早上9点到下午3点！');">-->
                            <!--<div class="aui-btn" style="width:100px;height:40px;color:#ffffff;line-height:40px;margin-left:5px;background-color: green !important;">看跌询价</div>-->
                        <!--</a>-->
                    <!--</div>								-->

                </div>


    </li>

    </ul>
    </div>
</form>
<footer class="aui-bar aui-bar-tab" id="footer">
    <div class="aui-bar-tab-item">
        <a href="{:url('user/Index/index')}" style="color:#757575">
            <i class="aui-iconfont aui-icon-home"></i>
            <div class="aui-bar-tab-label">首页</div>
        </a>
    </div>
    <div class="aui-bar-tab-item aui-active">
        <a href="{:url('user/Xunjia/index')}" style="color:#ffffff">
            <i class="aui-iconfont aui-icon-cert"></i>
            <div class="aui-bar-tab-label">询价</div>
        </a>
    </div>
    <div class="aui-bar-tab-item">
        <a href="{:url('user/Chicang/index')}" style="color:#757575">
            <i class="aui-iconfont aui-icon-image"></i>
            <div class="aui-bar-tab-label">持仓</div>
        </a>
    </div>

    <div class="aui-bar-tab-item">
        <a href="{:url('user/UserCenter/index')}" style="color:#757575">
            <i class="aui-iconfont aui-icon-my"></i>
            <div class="aui-bar-tab-label">我的</div>
        </a>
    </div>
</footer>
</body>
<script type="text/javascript" src="/static/index_user/js/api_1.js"></script>
<script type="text/javascript" src="/static/index_user/js/aui-tab_1.js"></script>
<script type="text/javascript" src="/static/index_user/js/aui-slide_1.js"></script>

<script>
    $('.kc').click(function() {
        //console.log($(this).attr('val'));
        stockcode = $("#xdstockcode").val()
        if($.trim(stockcode) == '') {
            alert('请输入股票代码');
            return;
        }
        jyzq = $("input[name='jyzq']:checked").val();
        if($.trim(jyzq) == '') {
            alert('请选择交易周期');
            return;
        }
        mybj = $("input[name='mybj']:checked").val();
        if($.trim(mybj) == '') {
            alert('请选择名义本金');
            return;
        }
        $('#dom').attr('action', $(this).attr('val')).submit()

    })
</script>

</html>

<script>
    showmsg();
    function showmsg() {
//        var $=jQuery;
//        console.log($);
        $.ajax({
            type: 'get',
            url: '/msg',
            dataType: 'json',
            success: function (data) {
//                console.log(data);
                if(data){
//                    console.log(111)
                    $('#msg').show();
                }else{
//                    console.log(222)
                    $('#msg').hide();
                }
            },
            error: function () {
            }
        });



        msgtimer=setTimeout('showmsg()', 2000);
    }
</script>